//app.js
App({
  onLaunch: function () {
    let that = this;
    // 展示本地存储能力
    wx.clearStorageSync();
    let addressPoint = [];
    let addressName = []
    wx.request({
      url: that.globalData.baseUrl + "/battle",
      method: "GET",
      success(res) {
        res.data.forEach((val, idx) => {
          addressPoint[idx] = val.location;
          addressName[idx] = val.name;
        });
        that.globalData.businessAddressPonit = addressPoint;
        that.globalData.businessAddressName = addressName;
      },
      fail(err) {
        wx.showModal({
          title: '错误',
          content: '服务器异常，获取砂场位置失败请稍后再试！无法提供配送点计算服务',
          showCancel: false,
          success(res) {
            if (res.confirm) {
              return;
            }
          }
        })
      }
    })
  },
  globalData: {
    userInfo: null,
    baseUrl: "https://www.yhgf.ltd/grit",
    imgBaseUrl: "https://www.yhgf.ltd/grit",
    customerPhone: "7770816",
    businessAddressPonit:[],
    businessAddressName: []
  }
})